﻿<script>
$(document).ready(function () { 
   var zhanshiboxsetInterval;
   $(function(){	
      /*   
	   if( String(location).indexOf("Wap&c=Index&a=index") == -1 && String(location).indexOf("Wap&c=Index&a=hb") == -1 ){
		    $.post("{:U('Ajax/checkzhanghu')}",{},function(res){
				if(res.code==1){
					 alert('请先拆红包');
					 $.post("{:U('Ajax/gethbid')}",{hbid:{$hb[id]|intval}},function(res){
					     location.href='{:U("hb?hbid=")}'+res.hbid;
					 },'json');
				}
			},'json');
	   }
	   */
	   $.post("{:U('Ajax/getfaqiancishu')}",{},function(res){});
	   $.post('{:U("Ajax/fayongjin")}',{},function(){	});
	   $.post('{:U("Ajax/checkuserhb")}',{},function(){	});
	   zhanshiboxsetInterval = setInterval(zhanshibox, 10000);
	   zhanshibox();
   });
   $('#qianghongbao').click(function(){
	   $.post("{:U('Ajax/gethbid')}",{hbid:{$hbid|intval}},function(res){
			location.href='{:U("Index/hb?hbid=")}'+res.hbid;
	   },'json');
   });
   $('#checkdaili').click(function(){
	   $.post("{:U('Ajax/checkdaili')}",{},function(res){
		   if(res.code == 0){
			   location.href='{:U("Index/kefu")}';
		   } else {
			   location.href='{:U("Index/daili")}';
		   }
	   },'json');
   });
   $('.msgbox .but').click(function(){
	    var msgbox = $("input[name='msgbox']").val();
		if(msgbox == 1){
            $.post("{:U('Ajax/checkzhanghu')}",{hbid:{$hbid|intval}},function(res){
				if(res.code==1){
					location.href = "{:U('Index/hb?hbid='.$hbid)}";
				} else {
				    location.href = "{:U('Chongzhi/chong?ctype=1&hbid='.$hbid)}";
				}
			},'json');
			return false;
		}
		if(msgbox == 2){
            $.post("{:U('Ajax/checkzhanghu')}",{hbid:{$hbid|intval}},function(res){
				if(res.code==1){
					location.href = "{:U('Zhuanpan/index')}";
				} else {
				    location.href = "{:U('Chongzhi/chong?ctype=2&hbid='.$hbid)}";
				}
			},'json');
			return false;
		}
		if(msgbox == 4){
			location.href = "{:U('Ucenter/index')}";	
			return false;
		}
		$('.msgbox').hide();
   });   
});
function zhanshibox(){
	$.post("{:U('Ajax/zhanshibox')}",{},function(res){	 
	    $('.zhanshibox').show(500);
	    if(res.code == 1){
		    $('.zhanshibox').hide();
			clearInterval(zhanshiboxsetInterval);
		}   
		$('.zhanshibox p').html(res.html);
		$('.zhanshibox p').fadeIn(500);
	},'json');
	setTimeout(function(){$('.zhanshibox p').fadeOut(500);}, 8000);
}
</script>
<style>
.zhanshibox { position: absolute; top: 0; left: 0; right: 0; height: 24px; background-color: rgba(0,0,0,0.3); text-align: center; font-size: 12px; line-height: 24px; color: #FFF; display: none; z-index: 9; }
.zhanshibox p { display: none; }
.zhanshibox span { color: #3F0; border: #3F0 1px solid; padding-left: 2px; padding-right: 2px; border-radius: 2px; }
</style>
<div class="msgbox">
  <input type="hidden" value="0" name="msgbox">
  <!--
      0无跳转 
      1拆红包 
      2转盘 
      4个人中心
  -->
  <div class="box">
    <p class="title">提示</p>
    <p class="txt">恭喜您获得0元红包</p>
    <p class="but">确定</p>
  </div>
</div>
<div class="zhanshibox">
  <p></p>
</div>
<div style="height:60px;"></div>
<div class="footer">
  <ul>
    <li><a href="{:U('Index/index?randres='.rand(100,999))}">抢红包</a></li>
    <li><a href="{:U('Zhuanpan/index?randres='.rand(100,999))}">大转盘</a></li>
    <li><a href="{:U('Index/yongjin?randres='.rand(100,999))}">佣金</a></li>
    <li id="checkdaili">代理</li>
    <li><a href="{:U('Ucenter/index?randres='.rand(100,999))}">我</a></li>
  </ul>
</div>
